﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using NCC_SOP.app_codes;

namespace NCC_SOP
{
    public partial class SiteMaster : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (!Page.User.Identity.IsAuthenticated)
                {
                    FormsAuthentication.RedirectToLoginPage();
                }
                else
                {
                    ((Label)LoginView1.FindControl("LoggedInUserName")).Text = "Welcome, " + Page.User.Identity.Name + ".";
                }
            }

            string rptID = (string)Session["currViewingRpt"];
            AuditUtil audit = new AuditUtil();
            audit.auditLog_viewRpt(rptID, Page.User.Identity.Name);
        }
        protected void OnLoggedOutEvent(object sender, EventArgs e)
        {
            Response.Redirect("~/login.aspx");
        }
    }
}
